import request from '@/utils/request'

export default {
    getaddFmeditemAPI(fmeditem) {
        return request({
            url: '/fmeditem/addFmeditem',
            method: 'POST',
            data: {
                id: 0,
                itemCode: fmeditem.ItemCode,
                itemName:fmeditem.ItemName,
                format:fmeditem.Format,
                price:fmeditem.Price,
                expClassID:fmeditem.ExpClassID,
                deptID:fmeditem.DeptID,
                mnemonicCode:fmeditem.MnemonicCode,
                creationDate:(function newtime(){
                    var time=new Date();
                    var year= time.getFullYear()
                    var month=time.getMonth()+1
                    var day=time.getDate()
                    var hour=time.getHours()
                    var minute=time.getMinutes()
                    var second=time.getSeconds()
                    return year+'-'+month+'-'+day+' '+hour+':'+minute+':'+second
                   })(),
                lastUpdateDate:null,
                recordType:fmeditem.RecordType,
                delMark:null
            }
        })
    },
    getdeleteFmeditemAPI(deleteid) {
        console.log(deleteid);
        return request({
            url: '/fmeditem/deleteFmeditem',
            method: 'POST',
            params:{
                id:deleteid
            }
        })
    },
    getdelFmeditemByIdsAPI(ids) {
        return request({
            url: '/fmeditem/delFmeditemByIds',
            method: 'POST',
            data: ids
        })
    },
    getupdateFmeditemAPI(fmeditem) {
        return request({
            url: '/fmeditem/updateFmeditem',
            method: 'POST',
            data:{
                id:fmeditem.id,
                itemCode: fmeditem.ItemCode,
                itemName:fmeditem.ItemName,
                format:fmeditem.Format,
                price:fmeditem.Price,
                expClassID:fmeditem.ExpClassID,
                deptID:fmeditem.DeptID,
                mnemonicCode:fmeditem.MnemonicCode,
                creationDate:null,
                lastUpdateDate:(function newtime(){
                    var time=new Date();
                    var year= time.getFullYear()
                    var month=time.getMonth()+1
                    var day=time.getDate()
                    var hour=time.getHours()
                    var minute=time.getMinutes()
                    var second=time.getSeconds()
                    return year+'-'+month+'-'+day+' '+hour+':'+minute+':'+second
                   })(),
                recordType:fmeditem.RecordType,
                delMark:null,
            }
        })
    },
    getpageFmeditemAPI(pageIndex,itemName,recordType) {
        return request({
            url: '/fmeditem/pageFmeditem',
            method: 'GET',
            params: {
                page: pageIndex,
                limit: 8,
                itemName:itemName,
                recordType:recordType
            }
        })
    },
    getexportExcelAPI(){
        return request({
            url: '/fmeditem/exportExcel',
            method: 'GET',
    })
    }
}